<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class AddressController extends Controller
{
   
    // 地址添加
    public function insert(Request $request)
    {
    	$data=$request->except(['_token']);
    	// $data['id']=session('id'); 用session添加用户id
    	$data['id']=1;
    	
    	//添加到数据库
    	$res=DB::table('shop_address')->insert($data);

    	if($res){
    		//成功 到订单页
            return redirect('/home/order');
    	}else{
    		return back();
    	}
    }
}
